<?php

/**
 * 分类标签
 * Some rights reserved：rfcsite.com
 * Contact email:458481812@qq.com
 */
namespace Home\TagLib;

class Article {
	public $db, $table_name, $modelid, $where;
	
	/**
	 * 列表
	 * 
	 * @param
	 *        	$catid
	 */
	public function index($data) {
		
		$map[cache]=$data[cache];
		if ($data [tui])
			$where [tui] = "1";
		if ($data [img])
			$where [thumb] = array ("neq",'');
		
		$catid = $data ['catid'];
		$cates = F ( "Cates" );
		if ($catid) {
		
			$s = array ();
			foreach ( explode ( ",", $catid ) as $k => $v ) {
				 
				$s = array_merge ( $s, explode ( ",", $cates [$v] [arrchildid] ) );
			}
			$where [catid] = array ("in",	$s);
		}
		
		$map[where]=$where;
		
		$map[limit] = $data ['limit']?$data ['limit']:0;
		
		$map[num]= $data ['num'] ? $data ['num'] : 20;
		
		return D("Article")->get_list($map);
	}
	public function nav($data) {
		$result = F ( "Cates_tree" );
		foreach ( $result as $key => $v ) {
			
			if (! $v [ismenu]) {
				
				unset ( $result [$key] );
			}
		}
		
		return $result;
	}
	

	

	
}
